<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    
    <script>
        function Person(name,age){
            this.name = name
            this.age = age
            this.run = function(){
                console.log(this.name+'在运动')
            }
        }
        //  静态方法
        Person.watch = function(){
            console.log('静态方法')
        }
        Person.prototype.sex = '男'
        Person.prototype.work = function(){
            console.log(this.name+'在工作')
        }
        var p = new Person('ywj',21)
        p.run()
        p.work()
        Person.watch()


        //  继承 原型链+对象冒充
        function Web(name,age){
            Person.call(this,name,age)
        }
        Web.prototype = Person.prototype
        var w = new Web('ywj1',21)
        w.run()
        w.work()
        
    </script>
</body>
</html>